<!--
 * @Description: 
 * @Autor: 商晓彬
 * @Date: 2021-08-12 16:13:24
 * @LastEditors: 商晓彬
 * @LastEditTime: 2022-02-14 09:17:46
-->
<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="modal fade maintain" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div style="width:1880px!important;margin: 1.75rem auto;">
        <div class="modal-content">
            <form *ngIf="active" #userForm="ngForm" novalidate autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span>{{title}}</span>
                    </h4>
                    <button [hidden]="addFlag" type="button" class="close" (click)="close()"
                        [attr.aria-label]="l('Close')" [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div>
                        <div class="m-content">
                            <div class="row">
                                <!-- 树 -->
                                <div class="col-lg-4">
                                    <span class="title">规程信息</span>
                                    <div class="m-content">
                                        <div class="m-portlet m-portlet--mobile">
                                            <div class="m-portlet__body">
                                                <div class="row align-items-center">
                                                    <div class="primeng-datatable-container"
                                                        [busyIf]="primengTableHelper.isLoading">
                                                        <div class="col-md-12" style="
                                                                float: left;
                                                                height: 600px;
                                                            ">
                                                            <div style="margin-bottom: 1rem">
                                                                <button pButton type="button" label="全部展开"
                                                                    (click)="expandAll()"
                                                                    style="margin-right: 0.5rem"></button>
                                                                <button pButton type="button" label="全部折叠"
                                                                    (click)="collapseAll()"
                                                                    style="margin-right: 0.5rem"></button>
                                                                <button pButton type="button" label="新增"
                                                                    (click)="insertBopTree(true)"
                                                                    style="margin-right: 0.5rem"></button>
                                                                <button pButton type="button" label="修改"
                                                                    (click)="insertBopTree(false)"
                                                                    style="margin-right: 0.5rem"></button>
                                                                <button pButton type="button" label="删除"
                                                                    (click)="deleteItem()"
                                                                    style="margin-right: 0.5rem"></button>
                                                            </div>
                                                            <p-tree [value]="files2" selectionMode="single"
                                                                [(selection)]="ischeckTree"
                                                                (onNodeSelect)="nodeSelect($event)"
                                                                [style]="{ height: '90%' }" [loading]="loadingtree">
                                                                <ng-template let-node pTemplate="default">
                                                                    <img class="imgcontent"
                                                                        src="../../../assets/common/images/三级图标.png"
                                                                        *ngIf="node.nodeLevel==8||node.nodeLevel==9"
                                                                        width="20" height="20" />
                                                                    <img class="imgcontent"
                                                                        src="../../../assets/common/images/0.png"
                                                                        *ngIf="node.nodeLevel!=8&&node.nodeLevel!=9"
                                                                        width="20" height="20" />
                                                                    <span>{{node.nodeDrawingNo}}-{{node.nodeName}}</span>
                                                                </ng-template>
                                                            </p-tree>
                                                        </div>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!-- 右侧 -->
                                <div class="col-lg-8">
                                    <span class="title">规程详情</span>
                                    <!-- 父级 -->
                                    <div *ngIf="ischeckTree&&ischeckTree.nodeLevel==0">
                                        <p-tabView [style]="{ height: '700px' }">
                                            <p-tabPanel header="规程描述" [selected]="true">
                                                <div class="col-xl-12" style="height: 600px;">
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        规程代码：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{ischeckTree?ischeckTree.nodeDrawingNo:''}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        规程名称：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{ischeckTree?ischeckTree.nodeName:''}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-12"
                                                        style="float: left;overflow: auto;height: 90%">
                                                        <div class="modal-body">
                                                            <div class="form-group">
                                                                <label for="nodeDrawingNo">图号</label>
                                                                <input id="nodeDrawingNo" name="nodeDrawingNo" disabled
                                                                    class="form-control"
                                                                    [(ngModel)]="btInfo.nodeDrawingNo"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="nodeName">名称</label>
                                                                <input id="nodeName" name="nodeName" disabled
                                                                    class="form-control" [(ngModel)]="btInfo.nodeName"
                                                                    maxlength="256" />
                                                            </div>
                                                            <hr style="margin-top: 50px;
                                                            height: 25px;
                                                            border-color: #AAAAAA;">
                                                            <div class="form-group">
                                                                <label for="btInfoDate">规程关联时间</label>
                                                                <input id="btInfoDate" readonly name="btInfoDate"
                                                                    class="form-control" [(ngModel)]="btInfoDate"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="padName">规程导出PAD</label>
                                                                <input id="padName" readonly name="padName"
                                                                    class="form-control" [(ngModel)]="btInfo.padName"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="btInfoNewDate">规程导出时间</label>
                                                                <input id="btInfoNewDate" readonly name="btInfoNewDate"
                                                                    class="form-control" [(ngModel)]="btInfoNewDate"
                                                                    maxlength="256" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <!-- <div class="col-md-12"
                                                        style="height: 5%;display: flex;justify-content: center;">
                                                        <button pButton type="button" label="保存"
                                                            (click)="saveMiao()"></button>
                                                    </div> -->
                                                </div>
                                            </p-tabPanel>
                                            <p-tabPanel header="工艺规程">
                                                <div class="col-xl-12" style="height: 600px;">
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        工艺规程编号：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{processFile?processFile.techniqueNumber:''}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        工艺规程名称：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{processFile?processFile.techniqueName:''}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-12"
                                                        style=" float: left;overflow: auto;height: 90%;margin-top: 5px;">
                                                        <div class="modal-body">
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="techniqueNumber"
                                                                    style="margin: 5px;margin-right: 40px;">文件编号:</label>
                                                                <input id="techniqueNumber"
                                                                    style="width: 300px;margin-right: 200px;" readonly
                                                                    name="techniqueNumber" class="form-control"
                                                                    [(ngModel)]="processFile.techniqueNumber"
                                                                    maxlength="256" />
                                                                <label for="techniqueName"
                                                                    style="margin: 5px;margin-right: 12px;">工艺文件名称:</label>
                                                                <input id="techniqueName" #techniqueNameInput="ngModel"
                                                                    readonly style="width: 300px;" name="techniqueName"
                                                                    class="form-control"
                                                                    [(ngModel)]="processFile.techniqueName"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="systemCode"
                                                                    style="margin: 5px;margin-right: 12px;">产品系统代号:</label>
                                                                <input id="systemCode" #systemCodeInput="ngModel"
                                                                    style="width: 300px;margin-right: 200px;" readonly
                                                                    name="systemCode" class="form-control"
                                                                    [(ngModel)]="processFile.systemCode"
                                                                    maxlength="256" />
                                                                <label for="productCode"
                                                                    style="margin: 5px;margin-right: 40px;">产品代号:</label>
                                                                <input id="productCode" #processCodeInput="ngModel"
                                                                    readonly style="width: 300px;" name="productCode"
                                                                    class="form-control" readonly
                                                                    [(ngModel)]="processFile.productCode"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="moduleCode"
                                                                    style="margin: 5px;margin-right: 12px;">零部组件代号:</label>
                                                                <input id="moduleCode" #moduleCodeInput="ngModel"
                                                                    style="width: 300px;margin-right: 200px;"
                                                                    name="moduleCode" class="form-control" readonly
                                                                    [(ngModel)]="processFile.moduleCode"
                                                                    maxlength="256" />
                                                                <label for="moduleName"
                                                                    style="margin: 5px;margin-right: 12px;">零部组件名称:</label>
                                                                <input id="moduleName" #moduleNameInput="ngModel"
                                                                    style="width: 300px;" name="moduleName"
                                                                    class="form-control" readonly
                                                                    [(ngModel)]="processFile.moduleName"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="stageSignDesc"
                                                                    style="margin: 5px;margin-right:40px;">阶段标记:</label>
                                                                <p-dropdown name="stageSignDesc"
                                                                    #moduleNameSelect="ngModel"
                                                                    [options]="stageSignOption" disabled
                                                                    [(ngModel)]="processFile.stageSign">
                                                                    <ng-template let-select pTemplate="selectedItem">
                                                                        <span
                                                                            style="vertical-align:middle; margin-left: .5em;width:275px;">{{select.label}}</span>
                                                                    </ng-template>
                                                                    <ng-template let-select pTemplate="select">
                                                                        <div class="ui-helper-clearfix"
                                                                            style="position: relative;height: 25px;">
                                                                            <div
                                                                                style="font-size:14px;float:right;margin-top:4px;width: 275px; ">
                                                                                {{select.label}}
                                                                            </div>
                                                                        </div>
                                                                    </ng-template>
                                                                </p-dropdown>
                                                                <label for="techniqueTypeDesc"
                                                                    style="margin: 5px;margin-right: 12px;margin-left: 205px;">工艺规程类型:</label>
                                                                <p-dropdown name="techniqueTypeDesc"
                                                                    #techniqueTypeDescSelect="ngModel" disabled
                                                                    [options]="techniqueTypecOption"
                                                                    [(ngModel)]="processFile.techniqueType">
                                                                    <ng-template let-select pTemplate="selectedItem">
                                                                        <span
                                                                            style="vertical-align:middle; margin-left: .5em;width:275px;">{{select.label}}</span>
                                                                    </ng-template>
                                                                    <ng-template let-select pTemplate="select">
                                                                        <div class="ui-helper-clearfix"
                                                                            style="position: relative;height: 25px;">
                                                                            <div
                                                                                style="font-size:14px;float:right;margin-top:4px;width: 275px; ">
                                                                                {{select.label}}
                                                                            </div>
                                                                        </div>
                                                                    </ng-template>
                                                                </p-dropdown>
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="techniqueCharacter"
                                                                    style="margin: 5px;margin-right: 12px;">工艺规程特性:</label>
                                                                <input id="techniqueCharacter" readonly
                                                                    style="width: 300px;margin-right: 200px;"
                                                                    #techniqueCharacterInput="ngModel"
                                                                    name="techniqueCharacter" class="form-control"
                                                                    [(ngModel)]="processFile.techniqueCharacter"
                                                                    maxlength="256" />
                                                                <label for="shapeDesc"
                                                                    style="margin: 5px;margin-right: 40px;">纸质形式:</label>
                                                                <p-dropdown name="shape" #shapeSelect="ngModel"
                                                                    [options]="shapeOption" disabled
                                                                    [(ngModel)]="processFile.shape">
                                                                    <ng-template let-select pTemplate="selectedItem">
                                                                        <span
                                                                            style="vertical-align:middle; margin-left: .5em;width:275px;">{{select.label}}</span>
                                                                    </ng-template>
                                                                    <ng-template let-select pTemplate="select">
                                                                        <div class="ui-helper-clearfix"
                                                                            style="position: relative;height: 25px;">
                                                                            <div
                                                                                style="font-size:14px;float:right;margin-top:4px;width: 275px; ">
                                                                                {{select.label}}
                                                                            </div>
                                                                        </div>
                                                                    </ng-template>
                                                                </p-dropdown>
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="secretDegreeDesc"
                                                                    style="margin: 5px;margin-right: 40px;">文件密级:</label>
                                                                <p-dropdown name="secretDegree" disabled
                                                                    #secretDegreeSelect="ngModel"
                                                                    [options]="secretDegreeOption"
                                                                    [(ngModel)]="processFile.secretDegree">
                                                                    <ng-template let-select pTemplate="selectedItem">
                                                                        <span
                                                                            style="vertical-align:middle; margin-left: .5em;width:275px;">{{select.label}}</span>
                                                                    </ng-template>
                                                                    <ng-template let-select pTemplate="select">
                                                                        <div class="ui-helper-clearfix"
                                                                            style="position: relative;height: 25px;">
                                                                            <div
                                                                                style="font-size:14px;float:right;margin-top:4px;width: 275px; ">
                                                                                {{select.label}}
                                                                            </div>
                                                                        </div>
                                                                    </ng-template>
                                                                </p-dropdown>
                                                                <label for="useUnit"
                                                                    style="margin: 5px;margin-right: 40px;margin-left: 205px;">使用单位:</label>
                                                                <input id="useUnit" #useUnitInput="ngModel"
                                                                    name="useUnit" class="form-control"
                                                                    style="width: 300px;" readonly
                                                                    [(ngModel)]="processFile.useUnit" maxlength="256" />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="useTime"
                                                                    style="margin: 5px;margin-right: 40px;">使用时间:</label>
                                                                <input id="useTime" #useTimeInput="ngModel"
                                                                    style="width: 300px;margin-right: 200px;"
                                                                    name="useTime" class="form-control" readonly
                                                                    [(ngModel)]="processFile.useTime" maxlength="256" />
                                                                <label for="basisFile"
                                                                    style="margin: 5px;margin-right: 40px;">依据文件:</label>
                                                                <input id="basisFile" #basisFileInput="ngModel"
                                                                    style="width: 300px;" name="basisFile"
                                                                    class="form-control" readonly
                                                                    [(ngModel)]="processFile.basisFile"
                                                                    maxlength="256" />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="issueUnit"
                                                                    style="margin: 5px;margin-right: 40px;">分发单位:</label>
                                                                <input id="issueUnit" #issueUnitInput="ngModel"
                                                                    style="width: 300px;margin-right: 200px;"
                                                                    name="issueUnit" class="form-control"
                                                                    [(ngModel)]="processFile.issueUnit" maxlength="256"
                                                                    readonly />
                                                                <label for="edition"
                                                                    style="margin: 5px;margin-right: 54px;">子版本:</label>
                                                                <input id="edition" style="width: 300px;" name="edition"
                                                                    class="form-control"
                                                                    [(ngModel)]="processFile.edition" maxlength="256"
                                                                    readonly />
                                                            </div>
                                                            <div class="form-group" style="display: flex;">
                                                                <label for="remark"
                                                                    style="margin: 5px;margin-right: 67px;">备注:</label>
                                                                <input id="remark" #remarkInput="ngModel"
                                                                    style="width: 906px;" name="remark"
                                                                    class="form-control"
                                                                    [(ngModel)]="processFile.remark" maxlength="256"
                                                                    readonly />
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <!-- <div class="col-md-12"
                                                        style="height: 5%;display: flex;justify-content: center;">
                                                        <button pButton type="button" label="保存"
                                                            (click)="saveGui()"></button>
                                                    </div> -->
                                                </div>
                                            </p-tabPanel>
                                            <p-tabPanel header="工艺说明卡片">
                                                <div class="item-content" style="float:left">工艺说明:</div>
                                                <div class="col-xl-12 " style="height: 582px;">
                                                    <div
                                                        style="overflow: auto;height: 90%;text-align: left;width: 100%;">
                                                        <p-editor name="techniqueExplain"
                                                            [(ngModel)]="btInfo.techniqueExplain"
                                                            [style]="{'height':'100%'}">
                                                            <p-header>
                                                                <span class="ql-formats">
                                                                    <button class="ql-bold" aria-label="Bold"></button>
                                                                    <button class="ql-italic"
                                                                        aria-label="Italic"></button>
                                                                    <button class="ql-underline"
                                                                        aria-label="Underline"></button>
                                                                </span>
                                                            </p-header>
                                                        </p-editor>
                                                    </div>
                                                    <div class="col-xl-12"
                                                        style="display: flex;justify-content: center;">
                                                        <button pButton type="button" label="保存"
                                                            (click)="saveText()"></button>
                                                    </div>
                                                </div>
                                            </p-tabPanel>
                                        </p-tabView>
                                    </div>
                                    <!-- 工序 -->
                                    <div *ngIf="ischeckTree&&ischeckTree.nodeLevel==8">
                                        <span class="title">BOP详情</span>
                                        <p-tabView [style]="{ height: '700px' }">
                                            <p-tabPanel header="工序说明" [selected]="true">
                                                <div class="col-xl-12">
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        工序代码：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{processInfo.processesSequence}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-6" class="item-content" style="float: left">
                                                        工序名称：
                                                        <span class="m-badge m-badge--success m-badge--wide">
                                                            {{processInfo.processesName}}
                                                        </span>
                                                        <span *ngFor="let item of check" style="border:2.5px solid red;
                                                        color: red;
                                                        padding: 5px;
                                                        font-size:16px;
                                                        margin-left:20px;">
                                                            {{item}}
                                                        </span>
                                                    </div>
                                                    <div class="col-md-12" style=" float: left">
                                                        <div class="content" style="height:550px;overflow:auto;">
                                                            <p-editor name="processesExplain"
                                                                [(ngModel)]="processInfo.processesExplain"
                                                                [style]="{'height':'100%'}">
                                                                <p-header>
                                                                    <span class="ql-formats">
                                                                        <button class="ql-bold"
                                                                            aria-label="Bold"></button>
                                                                        <button class="ql-italic"
                                                                            aria-label="Italic"></button>
                                                                        <button class="ql-underline"
                                                                            aria-label="Underline"></button>
                                                                    </span>
                                                                </p-header>
                                                            </p-editor>
                                                        </div>
                                                        <div class="col-xl-12"
                                                            style="display: flex;justify-content: center;">
                                                            <button pButton type="button" label="保存"
                                                                (click)="saveXu()"></button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </p-tabPanel>
                                        </p-tabView>
                                    </div>
                                    <!-- 工部 -->
                                    <div *ngIf="ischeckTree&&ischeckTree.nodeLevel==9">
                                        <div class="col-xl-24" style="height:30px;"
                                            *ngIf="workstepInfo&&workstepInfo.processesSequence">
                                            <div class="col-md-6" class="item-content" style="float: left">
                                                工步代码：
                                                <span class="m-badge m-badge--success m-badge--wide">
                                                    {{ischeckTree.nodeDrawingNo}}-{{ischeckTree.nodeName}}
                                                </span>
                                            </div>
                                            <div class="col-md-6" class="item-content" style="float: left">
                                                工序名称：
                                                <span class="m-badge m-badge--success m-badge--wide">
                                                    {{workstepInfo.processesName}}
                                                </span>
                                            </div>
                                        </div>
                                        <div class="col-md-24" class="item-content-step" style="height:250px;">
                                            <div class="col-md-6" class="item-content"
                                                style="float: left;height:100%;overflow: auto;">
                                                <p-card header="工步信息" [style]="{width: '500px'}">
                                                    <div class="content" *ngIf="workstepInfo.workStepOut">
                                                        <p-editor name="workDetails"
                                                            [(ngModel)]="workstepInfo.workStepOut.workDetails"
                                                            [style]="{'height':'100%'}">
                                                            <p-header>
                                                                <span class="ql-formats">
                                                                    <button class="ql-bold" aria-label="Bold"></button>
                                                                    <button class="ql-italic"
                                                                        aria-label="Italic"></button>
                                                                    <button class="ql-underline"
                                                                        aria-label="Underline"></button>
                                                                </span>
                                                            </p-header>
                                                        </p-editor>
                                                    </div>
                                                </p-card>
                                            </div>
                                            <div class="col-md-6" class="item-content" style="float: left;height:100%;">
                                                <p-card header="工步图片" [style]="{width: '550px'}">
                                                    <div style="display: flex;margin-bottom: 10px;">
                                                        <p-fileUpload mode="basic" customUpload="true" chooseLabel="新增"
                                                            (uploadHandler)="myUploader($event,-1)"
                                                            [(files)]="uploadedFiles" multiple="true" auto="auto"
                                                            accept="image/*" maxFileSize="1000000">
                                                        </p-fileUpload>
                                                        <button pButton type="button" label="保存图片" (click)="savePhoto()"
                                                            style="margin-left: 10px;"></button>
                                                    </div>
                                                    <div *ngFor="let item of photoList;let i = index"
                                                        style="display: flex;flex-wrap: wrap;">
                                                        <a *ngIf="item.src != undefind" target="_blank"
                                                            [href]="item.src">
                                                            <img [src]="item.src" height="100px" width="100px"></a>
                                                        <div *ngIf="item.name != undefind" style="margin-left: 5px;">
                                                            <label
                                                                style="margin-top: 5px;margin-right: 5px;">名称：</label>
                                                            <input style=" width:150px;height: 35px;margin-right: 5px;"
                                                                [name]="item.name+i" type="text"
                                                                [(ngModel)]="item.pName" />
                                                        </div>
                                                        <i [hidden]="i == 0 && photoList.length == 1"
                                                            class="pi pi-trash"
                                                            style="font-size: 3em;cursor: pointer;color:#888888"
                                                            (click)="photoDel(i)"></i>
                                                        <p-fileUpload mode="basic" customUpload="true" chooseLabel="新增"
                                                            (uploadHandler)="myUploader($event,i)"
                                                            [(files)]="uploadedFiles" multiple="true" auto="auto"
                                                            accept="image/*" maxFileSize="1000000">
                                                        </p-fileUpload>
                                                    </div>
                                                    <!-- <div class="content" style="margin: 10px;"
                                                        [innerHTML]="workstepInfo&&workstepInfo.workStepOut&&workstepInfo.workStepOut.workStepContent">
                                                    </div> -->
                                                </p-card>
                                            </div>
                                        </div>
                                        <div class="col-md-12" class="item-content "
                                            style="float: left;margin-top: 20px; height: 100%;">
                                            <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid">
                                                <div class="ui-grid-row">
                                                    <div class="ui-grid-col-1">表名：</div>
                                                    <div class="ui-grid-col-4">
                                                        <p-dropdown name="tablemodel" [panelStyle]="{width:'400px'}"
                                                            [options]="genders" defaultLabel="请选择表名"
                                                            [(ngModel)]="tablemodel" filter="true">
                                                            <ng-template let-item pTemplate="selectedItem">
                                                                <span
                                                                    style="vertical-align:middle; margin-left: .5em">{{item.label}}</span>
                                                            </ng-template>
                                                            <ng-template let-car pTemplate="item">
                                                                <div class="ui-helper-clearfix"
                                                                    style="position: relative;height: 25px;">
                                                                    <div
                                                                        style="font-size:14px;float:right;margin-top:4px">
                                                                        {{car.label}}</div>
                                                                </div>
                                                            </ng-template>
                                                        </p-dropdown>
                                                    </div>
                                                    <div class="ui-grid-col-2">
                                                        <button pButton type="button" style="margin-left: 20px;"
                                                            label="新增表格" (click)="addBu()"></button>
                                                    </div>
                                                </div>
                                            </div>
                                            <p-tabView [controlClose]="true" (onClose)="handleClose($event)"
                                                (onChange)="onTabChange($event)" [styleClass]="tabclass">
                                                <p-tabPanel [header]="tableitem.tableName" [selected]="i == 0"
                                                    [closable]="true"
                                                    *ngFor="let tableitem of workstepInfo.tableNameDictionary;let i = index">
                                                </p-tabPanel>
                                                <div class="col-xl-24">
                                                    <div class="primeng-datatable-container processlabel">
                                                        <p-table #dataTable [value]="workStepData" [paginator]="false"
                                                            dataKey="id" [scrollable]="true" ScrollWidth="100%">
                                                            <ng-template pTemplate="header">
                                                                <tr>
                                                                    <th [hidden]="tableShowFlag" style="width:125px">操作
                                                                    </th>
                                                                    <th style="width: 100px"
                                                                        *ngFor="let headerItem of (workStepHeader&&workStepHeader.filedName?workStepHeader.filedName:[])">
                                                                        {{headerItem}}
                                                                    </th>
                                                                </tr>
                                                            </ng-template>
                                                            <ng-template pTemplate="body" let-record="$implicit"
                                                                let-rowIndex="rowIndex">
                                                                <tr>
                                                                    <td [hidden]="tableShowFlag" style="width: 125px;height: 50px;position: relative;">
                                                                        <i *ngIf="paneName == '装入件明细'"
                                                                            class="pi pi-plus hide"
                                                                            style="font-size: 2em;cursor: pointer;"
                                                                            (click)="tableAdd(record,rowIndex,1)"
                                                                            data-tips="设计BOM"></i>
                                                                        <i *ngIf="paneName == '装入件明细'"
                                                                            class="pi pi-plus hide"
                                                                            style="font-size: 2em;cursor: pointer;margin-left: 24px;"
                                                                            (click)="tableAdd(record,rowIndex,2)"
                                                                            data-tips="物料建模"></i>
                                                                        <i *ngIf="paneName != '装入件明细'"
                                                                            class="pi pi-plus"
                                                                            style="font-size: 2em;cursor: pointer;"
                                                                            (click)="tableAdd(record,rowIndex,0)"></i>
                                                                        <i class="pi pi-trash"
                                                                            [hidden]="rowIndex == 0 && workStepData.length == 1"
                                                                            style="font-size: 2em;margin-left: 45px;cursor: pointer;"
                                                                            (click)="tableDelete(record,rowIndex)"></i>
                                                                    </td>
                                                                    <td style="width: 100px" pEditableColumn
                                                                        *ngFor="let headerprop of (workStepHeader&&workStepHeader.filedDesc?workStepHeader.filedDesc:[])">
                                                                        <p-cellEditor>
                                                                            <ng-template pTemplate="input">
                                                                                <input name="record[headerprop]"
                                                                                    pInputText type="text"
                                                                                    [(ngModel)]="record[headerprop]">
                                                                            </ng-template>
                                                                            <ng-template pTemplate="output">
                                                                                {{record[headerprop]}}
                                                                            </ng-template>
                                                                        </p-cellEditor>
                                                                    </td>
                                                                </tr>
                                                            </ng-template>
                                                        </p-table>
                                                    </div>
                                                </div>
                                            </p-tabView>
                                        </div>
                                        <div class="col-md-24">
                                            <button pButton type="button" style="margin-left: 550px;" label="保存"
                                                (click)="saveBu()"></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <!-- <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" class="btn btn-primary" [disabled]="!userForm.form.valid" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button> -->
                </div>
                <!-- 新增BOP -->
                <p-dialog class="dialog" draggable=false header="新增" [(visible)]="addFlag"
                    [style]="{width: '500px', height: '300px'}" [baseZIndex]="1000">
                    <div class="modal-body" *ngIf="addFlag">
                        <div class="form-group" *ngIf="!leveFlag">
                            <label for="materialCode" style="margin-top: 7px;">工序序号*</label>
                            <input name="addmaterialCode" style="margin-left: 10px;" id="addmaterialCode" type="number"
                                class="form-control" [(ngModel)]="addForm.materialCode" maxlength="256" />
                        </div>
                        <div class="form-group" *ngIf="leveFlag">
                            <label for="workCode" style="margin-top: 7px;">工步序号*</label>
                            <input name="workCode" style="margin-left: 10px;" id="workCode" type="number"
                                class="form-control" [(ngModel)]="addForm.workCode" maxlength="256" />
                        </div>
                        <div class="form-group" *ngIf="!leveFlag">
                            <label for="materialname" style="margin-top: 7px;">名称*</label>
                            <input name="addmaterialname" style="margin-left: 10px;" id="addmaterialname" type="text"
                                class="form-control" [(ngModel)]="addForm.materialname" maxlength="256" />
                        </div>
                    </div>
                    <div class="modal-footer" style="margin-top: 14px;display: flex;justify-content: center;">
                        <button *ngIf="!leveFlag "
                            [disabled]="addForm.materialname == undefind || addForm.materialCode == undefind || addForm.materialname == '' || addForm.materialCode == ''"
                            pButton type="button" label="保存" (click)="addTree(1)"></button>
                        <button *ngIf="leveFlag" [disabled]=" addForm.workCode == undefind || addForm.workCode == ''"
                            pButton type="button" label="保存" (click)="addTree(2)"></button>
                    </div>
                </p-dialog>
                <!-- 修改BOP -->
                <p-dialog class="dialog" draggable=false header="修改" [(visible)]="editFlag"
                    [style]="{width: '500px', height: '300px'}" [baseZIndex]="1000">
                    <div class="modal-body" *ngIf="editFlag ">
                        <div class="form-group" *ngIf="updateFlag">
                            <label for="materialCode" style="margin-top: 7px;">工序序号*</label>
                            <input name="addmaterialCode" style="margin-left: 10px;" id="addmaterialCode" type="number"
                                class="form-control" [(ngModel)]="addForm.materialCode" maxlength="256" />
                        </div>
                        <div class="form-group" *ngIf="!updateFlag">
                            <label for="workCode" style="margin-top: 7px;">工步序号*</label>
                            <input name="workCode" style="margin-left: 10px;" id="workCode" type="number"
                                class="form-control" [(ngModel)]="addForm.workCode" maxlength="256" />
                        </div>
                        <div class="form-group" *ngIf="updateFlag">
                            <label for="materialname" style="margin-top: 7px;">名称*</label>
                            <input name="addmaterialname" style="margin-left: 10px;" id="addmaterialname" type="text"
                                class="form-control" [(ngModel)]="addForm.materialname" maxlength="256" />
                        </div>
                    </div>
                    <div class="modal-footer" style="margin-top: 14px;display: flex;justify-content: center;">
                        <button *ngIf="updateFlag "
                            [disabled]="addForm.materialname == undefind || addForm.materialCode == undefind || addForm.materialname == '' || addForm.materialCode == ''"
                            pButton type="button" label="保存" (click)="editTree(1)"></button>
                        <button *ngIf="!updateFlag "
                            [disabled]=" addForm.workCode == undefind || addForm.workCode == ''" pButton type="button"
                            label="保存" (click)="editTree(2)"></button>
                    </div>
                </p-dialog>
                <!-- 装入件明细表新增 -->
                <app-mount-details #MountDetailsComponent [select]="workStepData" (modalSave)="backToMount($event)">
                </app-mount-details>
                <!-- 装入件BOM新增 -->
                <app-choose-bom #ChooseBomComponent [oldData]="workStepData" [select]="parentrow" (modalSave)="backToMount($event)">
                </app-choose-bom>
            </form>
        </div>
    </div>
</div>